package cc.rengu.igas.share.facade.bean.cups;

import cc.rengu.oltp.service.common.enums.OltpRpcdEnum;
import cc.rengu.oltp.service.model.BizException;

import java.util.Arrays;

/**
 * 域 125  IP    支付场景标识
 * 如受理侧未经过设备验证，或经过设备验证但未验证通过，则该 CV 用法在联机报文中不出现。
 *
 * @author fangminwei
 * @date 2021/4/17
 */
@SuppressWarnings("AlibabaEnumConstantsMustHaveComment")
public enum F125_IP_01_SceneFlagEnum {
    _001("001", "刷脸付"),
    _002("002", "充电桩支付"),
    _003("003", "车牌支付"),
    _004("004", "标签支付"),
    _005("005", "跨境交易保留使用（跨境交通二维码产品）"),
    ;

    private String code;
    private String desc;

    F125_IP_01_SceneFlagEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    @Override
    public String toString() {
        return code + "-" + desc;
    }

    public static F125_IP_01_SceneFlagEnum find(String code) {
        F125_IP_01_SceneFlagEnum result = Arrays.stream(F125_IP_01_SceneFlagEnum.values())
                .filter(e -> e.getCode().equals(code)).findFirst().orElse(null);

        if (result == null) {
            throw new BizException(OltpRpcdEnum.PARAM_IS_EMPTY_OR_NULL.getRespCode(), "找不到对应的枚举信息" + code);
        }
        return result;
    }
}
